<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
        "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <include file="Pub:head"/>
</head>
<body>

    <include file="top"/>
    <form method='POST' action='__URL__/savemessage' id="testform">
        <input type="hidden" name='isSend' value=1>
        <input type="hidden" name='isRead' value=0>
        <input type="hidden" name='DeletedByUsername' value=0>
        <input type="hidden" name='DeletedBySender' value=0>


        <table class="tableStyle">
            <tr>
                <td align='center' colspan='2'><strong>撰写任务</strong></td>
            </tr>
            <tr>
                <td width='20%' align='right'>接受人：</td>
                <td width='60%'>
                    <input type='hidden' name='username' size='52' id='InceptUser' value=''>
                    <select name="friendname" id="FriendList" onchange="SelectFromFriend();">
                        <volist name="userlist" id="vo">
                            <option value="{$vo['id']}">{$vo["name"]}</option>
                        </volist>
                    </select>
                </td>
            </tr>
            <tr>
                <td width='20%' align='right'>名字：</td>
                <td width='60%'>
                    <input type='text' name='xx' size='52' id='InceptUsername' value='' style="width: 400px">
                </td>
            </tr>
            <tr>
                <td align='right'>主题：</td>
                <td><input type='text' name='title' size='66' id='title' value='' style="width: 400px"></td>
            </tr>
            <tr>
                <td align='right'>内容：</td>
                <td><textarea  name='content' id='content'  style='width: 401px;height: 342px'></textarea>
                </td>
            </tr>
            <tr>
                <td height='40' colspan='2' align='center'>
                    <input type="button" value="保存" onclick="save();">
                    <input type="hidden" value="" id="ww" name="way">
                    <script language="javascript" type="text/javascript">


                        function SelectFromFriend() {
                            var str1 = $("#InceptUser").val();
                            var str2 = $("#FriendList").val();

                            var sname = $("#FriendList").find("option:selected").text();


                            if ($("#FriendList").val() != '') {
                                if (str1 == '') {
                                    $("#InceptUser").val(str2);
                                    $("#InceptUsername").val(sname);
                                }
                                else {
                                    if (checkFriend(str1, str2)) {
                                        $("#InceptUser").val(str1 + ',' + str2);
                                        var names = $("#InceptUsername").val();
                                        $("#InceptUsername").val(names + "," + sname);

                                    }
                                }
                            }


                        }

                        function checkFriend(friendlist, thisfriend) {
                            if (friendlist == thisfriend) {
                                return false;
                            }
                            else {
                                var str = friendlist.split(",");
                                for (i = 0; i < str.length; i++) {
                                    if (str[i] == thisfriend)
                                        return false;
                                }
                                return true;
                            }
                        }

                        function save() {
                            document.getElementById("ww").value = "submit";
                            document.getElementById("testform").submit();
                        }
                    </script>
                </td>
            </tr>
        </table>
    </form>



</body>
</html>